home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group95b.txt / 000040_icon-group-sender _Thu Jun 8 11:01:25 1995.msg < prev    next >
Internet Message Format  |  1995-09-18  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Thu, 8 Jun 1995 12:39:58 MST
  2. Date: Thu, 08 Jun 1995 11:01:25 -0500
  3. From: "Mark B. Emmer" <Mark.Emmer@internetmci.com>
  4. Subject: Re: implementation of integers in Icon
  5. To: "icon-group@cs.arizona.edu" <icon-group@cs.arizona.edu>
  6. Message-Id: <01HRGQGSZLIA985KIR@MAILSRV1.PCY.MCI.NET>
  7. X-Mailer: e-mailMCI v2.3
  8. Content-Transfer-Encoding: 7BIT
  9. Errors-To: icon-group-errors@cs.arizona.edu
  10.  
  11. -- [ From: Mark B. Emmer * EMC.Ver #2.3 ] --
  12.  
  13. > Is there any information available that explains how in  Icon (infinite)
  14. > integers are represented and processed?
  15.  
  16. Large integers are stored in a b_bignum struct, which has a few header
  17. words, and then an array of ints.  In 32-bit implementations, each array
  18. element holds a 16-bit "digit", so the number is stored in base 65536 form.
  19. The b_bignum block will vary in size with the magnitude of the number.
  20.  
  21. If you have the source, examine b_bignum in rstructs.h, and the code for
  22. manipulating large integers in rlrgint.r or rlrgint.c (depending upon the
  23. age of your source).  Although some of the boundary conditions that the
  24. code has to worry about are arcane, overall it's a fairly readable piece of
  25. code.
  26.  
  27.     -- Mark
  28.  
  29.